Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Week1 #22

Open
wants to merge 43 commits into
base: main
Choose a base branch
from
Open

Week1 #22

wants to merge 43 commits into from

Conversation

VicDik
Copy link
Member

@VicDik VicDik commented Jul 2, 2021

Add codware

Copy link
Member

@ad3002 ad3002 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Задачки решены правильно! Есть вопросы по стилистике. Часть решений можно сделать сильно быстрей, часть решений можно написать одной строкой.


''' def unique_in_order(unique:str):
list_1 = []
for id in range(len(unique)):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

len(unique) - в переменную нужно вынести, ты каждый раз вычисляешь ее

pass
else:
list_1.append(unique[id])
return list_1 '''
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

лапки должны быть на след строке


''' def unique_in_order(unique:str):
list_1 = []
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

странное название переменной, нужно переназвать чтобы было понятно что в ней

list_1 = []
for id in range(len(unique)):
if id == len(unique) - 1:
list_1.append(unique[id])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

не нужное условие, тут два более питоньих решения 1) сделать через enumerate 2) одной строкой через filter

@@ -1,6 +1,6 @@
# 1. Unique on order

''' def unique_in_order(unique:str):
``` def unique_in_order(unique:str):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

три лапки слово питон новая строка


```python
def disemvowel(string_):
for i in "aeiouAEIOU":
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Опять сложность квадратичная, можно сделать линейно, подсказка, используй
return "".join(...)

def get_middle(s):
if len(s) % 2 == 0:
return s[(len(s) // 2) - 1 : (len(s) // 2) + 1]
elif len(s) % 2 != 0:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут должен быть else, ни в одном языке нет конструкции if ... else if ...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

и позицию среднего элемента в отдельную переменную, чтобы не считать ее каждый раз

list_1 = []
for i in a:
if i in b:
pass
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if ... pass else something не надо испльзовать
она равнозначна конструкции одного if, еще это можно одной строкой

```python
def likes(names):
if len(names) == 0:
return "no one likes this"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Есть три варианта использования кавычек, у тебя перемешано

  1. двойные кавычки строки, одинарные символы (у нас)
  2. везде двойные
  3. везде одинарные

# [10. Unique on order.]
```python
def to_time(seconds):
return f"{seconds//3600} hour(s) and {seconds%3600//60} minute(s)"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в целом вычисление в темплейтах плохо, это очень сложно и читать и поддерживать

внутри темплейта должны быть переменные

VicDik and others added 4 commits July 5, 2021 19:47
Исправила решения и добавила новые
grdhgrdh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants